<%-- 
    Document   : customer-tree
    Created on : Mar 2, 2014, 8:45:30 AM
    Author     : jocke
--%>

<%@tag description="display" pageEncoding="UTF-8"%>
<%@attribute name="categories" type="java.util.List" required="true" %>
<%@attribute name="expand" type="java.lang.Boolean" required="true" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@taglib prefix="template" tagdir="/WEB-INF/tags" %>


<c:forEach var="cat" items="${categories}" varStatus="count">
    <ul>
        <li <c:if test="${!expand}"> style="display: none;"</c:if>>
            <span data-id="${cat.id}"><i class="icon-folder-open icon-plus-sign"></i>${cat.name}</span>
                <c:if test="${fn:length(cat.subCategories) > 0}">
                    <template:category-tree categories="${cat.subCategories}" expand="false"/>
                </c:if>
        </li>
    </ul>
</c:forEach>
